/**
 * Copyright 2025 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

.home-margin {
  margin: 2rem 1rem 10rem 1rem;
}

.video-container {
  height: 15vh;
  overflow: hidden;
  display: block;
  position: relative;
  border-radius: 1rem;

  video {
    margin-top: -15%;
  }
}

.item-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 1rem;
  color: black !important;

  &::-webkit-scrollbar {
    height: 8px; /* height of the horizontal scrollbar */
  }

  &::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
  }

  &::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
  }

  &::-webkit-scrollbar-thumb:hover {
    background: #555;
  }

  mat-card {
    background-color: #e8eae9 !important;
    cursor: pointer;
    width: 150px;
    flex-shrink: 0;
    transition:
      transform 0.2s ease-in-out,
      box-shadow 0.2s ease-in-out;

    &.selected {
      transform: scale(1.05);
      box-shadow: 0 0 15px rgba(0, 123, 255, 0.7);
      border: 2px solid #007bff;
    }

    &:hover {
      transform: scale(1.02);
    }

    img {
      object-fit: cover;
    }
  }
}

.item-example {
  mat-card {
    background-color: transparent !important;
  }
}

.item-clothes {
  mat-card {
    background-color: transparent !important;
    width: 100px;
  }

  .drop-zone {
    width: 100px;
    min-height: 100px;
    padding: 1rem;
    aspect-ratio: 1 / 1;
  }
}

.uploaded-model-container {
  margin-bottom: 1rem;
  h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
  }
  .item-row {
    padding-top: 0;
  }
}

.drop-zone {
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.3s,
    background-color 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 350px;
  background-color: rgba(255, 255, 255, 0.05);
  position: relative;
  aspect-ratio: 9 / 16;

  &:hover {
    border-color: #2d7cef;
    background-color: rgba(255, 255, 255, 0.1);
  }
}

.drop-zone-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #aaa;

  mat-icon {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
  }
}

.image-preview-container {
  position: relative;
  width: 100%;
  height: 100%;

  img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
  }

  .clear-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
  }
}

.clothing-selection-container {
  display: flex;
  gap: 24px;
}

.clothing-options {
  flex: 2;
  min-width: 0; /* Prevents flexbox overflow */
}

.right-column {
  flex: 2;
  display: flex;
  gap: 24px;
}

.preview-pane {
  flex: 1;
  border-left: 1px solid #ccc;
  padding-left: 24px;

  /* Make the preview pane sticky */
  position: sticky;
  top: 2rem;
  align-self: flex-start;
  max-height: calc(100vh - 4rem);
}

.preview-image-container {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin: auto;
  aspect-ratio: 9 / 16;

  .model-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .garment-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

::ng-deep .mat-stepper-horizontal {
  background-color: transparent !important;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: 1rem;
  color: white;
}

.output-pane {
  flex: 1;
}

.results-container {
  /* margin-top is no longer needed */
  color: white;
}

// Small devices (landscape phones, 576px and up)
@media (min-width: 576px) {
}

// Medium devices (tablets, 768px and up)
@media (min-width: 768px) {
  .video-container {
    height: 25vh;
  }
}

// Large devices (desktops, 992px and up)
@media (min-width: 992px) {
}

// X-Large devices (large desktops, 1200px and up)
@media (min-width: 1200px) {
  .home-margin {
    margin: 2rem auto;
  }

  ::ng-deep .image-selector-dialog {
    width: 70vw !important;
    max-width: 70vw !important;
  }
}

// XX-Large devices (larger desktops, 1400px and up)
@media (min-width: 1400px) {
}

// 4K Displays (Ultra HD) (Projectors or Higher Resolution Screens, 2160px and up)
@media screen and (min-width: 2160px) {
  .video-container {
    video {
      margin-top: -10%;
    }
  }
}
